Conversation
Review ChecklistHello reviewers! 👋 Please follow this checklist when reviewing this Pull Request. General
If a new flag is being introduced:
If a workflow is added or modified:
Bug fixes
Non-trivial changes
New/Existing features
Backward compatibility
|
7dc8821 to
fc7fbdd
Compare
shlomi-noach
left a comment
There was a problem hiding this comment.
Very thorough! I have one request for change, see lag throttler. Otherwise this looks good
There was a problem hiding this comment.
I'm not even sure what the old code means; the semaphore acts both as an atomic primitive and indicates the size?
There was a problem hiding this comment.
We had code that indeed checked this size but the x/sync Go semaphore doesn't expose that (as it's a total weight, not a real size).
That's why this had to be added as a separate field. Agreed it's a bit wonky but I didn't want to go and change behavior here.
vmg
left a comment
There was a problem hiding this comment.
LGTM. There's a pice of @shlomi-noach's feedback you haven't addressed yet btw
This change moves to Go 1.19 atomics in favor of the version we had in the `sync2` package. The version in that package predates the availability of the new atomics, but for the future we want to use the Go provided ones. On top of that, we can also use the semaphore from `x/sync` instead of a custom one in `sync2`. This cleans up a bunch of additional code from `sync2`. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
This can be any float, so we need to store the float bits in an atomic uint64 instead (as Go has no atomic floats). Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
aca478f to
ab6bda5
Compare
This change moves to Go 1.19 atomics in favor of the version we had in the
sync2package. The version in that package predates the availability of the new atomics, but for the future we want to use the Go provided ones.On top of that, we can also use the semaphore from
x/syncinstead of a custom one insync2. This cleans up a bunch of additional code fromsync2.Upsides are removing the mostly duplicate code from the standard library (albeit with slight different name) and that the stdlib implementation also guarantees things we can't, such as proper alignment for the atomic variables.
Related Issue(s)
Fixes #12395
Checklist